package com.lyhengtongwl.zqsnews.adapter;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lyhengtongwl.zqsnews.App;
import com.lyhengtongwl.zqsnews.R;
import com.lyhengtongwl.zqsnews.entity.NewsDD1Entity;
import com.makeramen.roundedimageview.RoundedImageView;
import com.squareup.picasso.Picasso;

import java.util.List;

public class NewsDD1Adapter extends BaseQuickAdapter<NewsDD1Entity, BaseViewHolder> {
    private Activity activity;

    public NewsDD1Adapter(Activity activity, List<NewsDD1Entity> newsList) {
        super(R.layout.item_ddd, newsList);
        this.activity = activity;
    }


    @SuppressLint("SetTextI18n")
    @Override
    protected void convert(BaseViewHolder helper, NewsDD1Entity item) {
        ((TextView) helper.getView(R.id.tv_id)).setText("ID：" + item.getId());
        ((TextView) helper.getView(R.id.tv_time)).setText("注册时间：" + (item.getTime()).substring(0, 10));
        Picasso.with(App.getContext()).load(item.getHead()).placeholder(R.mipmap.head).error(R.mipmap.head).into((RoundedImageView) helper.getView(R.id.iv_head));
    }
}
